home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / utility2 / wclib.zip / WCLIBC.ZIP / WORDFIX.WCM < prev   
Text File  |  1993-04-27  |  2KB  |  70 lines

  1. //============================================================
  2. // WinCmd program to fix problems with WinWord
  3. //
  4. // Copyright (c) 1993 Douglas Boling
  5. //============================================================
  6. //
  7. // Check to see if Word already running.  If so,
  8. // just switch to Word Window and exit
  9. //
  10. handle = checkrunning ("Microsoft Word")
  11. if (handle) do
  12.    appactivate (getwindowtext (handle))
  13.    exit
  14. end
  15.  
  16. //
  17. // Launch Word and wait .5 seconds
  18. //
  19. "winword.exe"
  20. delay (500)
  21.  
  22. //
  23. // Attempt to get handle to Word's main window.  If 
  24. // we can't quit.
  25. //
  26. handle = CheckRunning ("Microsoft Word")
  27. if (handle == 0) 
  28.    exit
  29.  
  30. // 
  31. // Move and size window to my specs
  32. //
  33. MoveWindow (handle, 200, 15)
  34. SizeWindow (handle, 800, 720)
  35. exit
  36.  
  37. //------------------------------------------------------------
  38. // CheckRunning - A routine that scans all windows to see
  39. // if a window has a partial matching title text
  40. //------------------------------------------------------------
  41. checkrunning:
  42. //
  43. // Get first window in window list
  44. //
  45. handle = getwindow (hmain, 0)
  46. //
  47. // Loop until no more windows
  48. // 
  49. while (handle <> 0) do
  50.    //
  51.    // Get window text
  52.    //
  53.    text = getwindowtext (handle) 
  54.    //
  55.    // If the first part of the window text matches the
  56.    // argument passed to CheckRunning return handle
  57.    //
  58.    if (substr (text, 0, length(arg(1))) == arg(1))
  59.       return handle
  60.    //
  61.    // Get next window handle in window list
  62.    //
  63.    handle = getwindow (handle, 2)
  64. end
  65. //
  66. // No matching window found, return 0
  67. //
  68. return 0
  69.  
  70.